<style>
.setimg{
	margin:-2px 5px 0 0 
}
</style>
<div class="row-fluid">
	<a style="border:1px solid #ccc" class="block-heading" data-toggle="collapse">列表数据</a>
    <div class="well">
	    <div class="btn-toolbar">
			<button class="btn btn-primary ifrm" data-url="/order/exportExcel" data-width="510" data-height="350" data-title="导出表格" data-params="" style="position:relative;float:right;padding:3px 6px;margin-right:10px" title="导出表格">导出表格</button>
			<button class="btn btn-primary ifrm" data-url="/order/importExcel" data-width="610" data-height="350" data-title="导入表格" data-params="" style="position:relative;float:right;padding:3px 6px;margin-right:10px" title="导入表格">导入表格</button>
		    <form>
		    	<label style="display: inline;">用户名称：</label><input class="input input-medium" type="text" name="cust_name" value="<?=I('get.cust_name')?>" />
		    	<label style="display: inline;margin-left:10px">订单编号：</label><input class="input input-medium" type="text" name="order_id" value="<?=I('get.order_id')?>" />
		    	<!--<label style="display: inline;margin-left:10px">用户id：</label><input class="input input-medium" style="width:60px" type="text" name="cust_id" value="<?=I('get.cust_id')?>" />-->
		    	
		    	<label style="display: inline;margin-left:10px">手机号码：</label><input class="input input-medium" type="text" name="cust_mobile" value="<?=I('get.cust_mobile')?>" />
		    	<label style="display: inline;margin-left:10px">订单状态：</label>
			 	<?php $getOrderStatus = C('ostatus');?>
			 	<select name="st">
			 		<option value="all">全部</option>
			 		<?php if($getOrderStatus){foreach($getOrderStatus AS $ks=>$val){?>
			 		<option <?= strval($ks) == strval(I('get.st')) && isset($_GET['st']) ? 'selected="selected"' : ''?> value=<?=$ks?>><?=$val?></option>
			 		<?php }}?>
			 	</select>
		    	<input type="hidden" value="<?=I('get.res')?>" name="res" />
		    	<button class="btn btn-info" style="margin:-9px 0 0 15px"><i class="icon-search"></i> 搜索</button>
		    </form>
		</div>
		<hr>
		<table class="table">
		      <thead>
		        <tr>
		          <th style="text-align:center;width:110px">订单编号</th>
			 	  <th style="text-align:center;width:180px">订单备注</th>
		          <th style="text-align:center;width:180px">用户信息</th>
		          <th style="text-align:center;width:350px">商品信息</th>
		          <th style="text-align:center;width:350px">收货信息</th>
		          <th style="text-align:center;width:190px">订单状态</th>
		          <th style="text-align:center;width:250px">订单生成时间</th>
		      	  <th style="text-align:center;width:130px">操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php if($getData){foreach($getData AS $key=>$val){ $order_status = C('ostatus')?>
		        <tr> 
		          <td style="text-align:center;vertical-align:middle"><?=$val['order_id']?></td>
		          <td style="text-align:center;vertical-align:middle"><span style="color: red;">{{$val['remark']|default='-'}}</span></td>
		          <td style="text-align:center;vertical-align:middle"><?=$val['nickname'] ?: '-'?></td>
		       	  <td style="text-align:center;vertical-align:middle"><center>
		       	  	<table>
				  	<?php
				  		$nums = 0;
				  		$price = 0;
						$sql = "SELECT a.goods_title,a.pay_nums,a.pay_price,a.express_num
								FROM fx_order_collect a
								LEFT JOIN fx_goods_entity b
								ON a.goods_id=b.goods_id
								WHERE b.resource=2 AND a.order_id=".$val['order_id'];
						$getGoods = CQuery($sql);
						if($getGoods){
						foreach($getGoods AS $vv){
						$nums += $vv['pay_nums'];
						$price += $vv['pay_price'];
						if(!$vv['express_num']){
							$express = true;
						}
					?>
				  		<tr>
							<td style="text-align:center;"><?=$vv['goods_title']?></td>
							<td style="text-align:center;"> × <?=$vv['pay_nums']?></td>
							<td style="text-align:center;"><?=$vv['pay_price']?> 元</td>
						</tr>
				  	<?php }}else{?>
				  		<tr>
							<td style="text-align:center;" colspan=3>
								没有数据
							</td>
						</tr>
				  	<?php }?>
					<!--<tr>-->
						<!--<td style="text-align:center;">税费</td><td style="text-align:center;"> × <?=$nums?></td>-->
						<!--<td style="text-align:center;"><?=number_format($val['order_taxes'],2)?> 元</td>-->
					<!--</tr>-->
					<!--<tr>-->
						<!--<td style="text-align:center;">运费</td><td style="text-align:center;"></td>-->
						<!--<td style="text-align:center;"><?=number_format($val['order_express'],2)?> 元</td>-->
					<!--</tr>-->
				  	<!--<tr>-->
						<!--<td style="text-align:center;">总计</td><td style="text-align:center;"> × <?=$nums?></td>-->
						<!--<td style="text-align:center;"><?=number_format($val['order_amount'],2)?> 元</td>-->
					<!--</tr>-->
					<tr>
					<td style="text-align:center;">总计</td><td style="text-align:center;"> × <?=$nums?></td>
					<td style="text-align:center;"><?=number_format($price,2)?> 元</td>
					</tr>
				  	</table></center>
				  </td>
					<td style="text-align:center;vertical-align:middle">
						<if condition="$val['receive_address']">
							<center>
							<table>
								<tr>
									<td style="text-align:center;">姓名：{{$val['receive_name']}}</td>
								</tr>
								<tr>
									<td style="text-align:center;">手机号码：{{$val['receive_mobile']}}</td>
								</tr>
								<tr>
									<td style="text-align:center;">身份证信息：{{$val['receive_identity']}}</td>
								</tr>
								<tr>
									<td style="text-align:center;">地址：{{$val['receive_address']}}</td>
								</tr>
							</table>
							</center>
						<else/>
							-
						</if>
					</td>
		          <td style="text-align:center;vertical-align:middle">
					  <span class="label label-<?=!$val['order_status'] ? 'defalut' : ($val['order_status'] == '2' ? 'warning' : 'info')?>">
						  <?=$order_status[$val['order_status']]?>
					  </span>
					  <p>
						  <if condition="$val['order_status'] eq 2">
							  <a class="ifrm" href="javascript:void(0)" data-url="/order/showExpress" style="padding: 0px 4px;" data-width="450" data-height="360" data-title="查看物流" data-params="order_id/<?=$val['order_id']?>" title="查看物流">查看物流</a>
						  </if>
					  </p>
				  </td>
		       	  <td style="text-align:center;vertical-align:middle"><?=date('Y-m-d H:i:s',$val['add_at'])?></td>
		          <td style="text-align:center;vertical-align:middle">
					  <if condition="$val['order_type'] neq 1">
				      <?php if(in_array($val['order_status'],array('5'))){?>
						  <if condition="$val['refund_type']">
							  <a class="ifrm btn btn-warning" href="javascript:void(0)" data-url="/order/refundly" style="padding: 0px 4px;" data-width="670" data-height="410" data-title="退货理由" data-params="oid/<?=$val['order_id']?>"><i class="icon-eye-open"></i></a>&nbsp;&nbsp;
						  </if>
					  <?php }elseif(in_array($val['order_status'],array('6')) && $val['refund_expressnum'] ){?>
						  <a class="ifrm btn btn-warning" href="javascript:void(0)" data-url="/order/refundwl" style="padding: 0px 4px;" data-width="670" data-height="410" data-title="退货物流" data-params="oid/<?=$val['order_id']?>"><i class="icon-eye-open"></i></a>&nbsp;&nbsp;
						  <a class="ifrm btn btn-warning" href="javascript:void(0)" data-url="/order/refundmon" style="padding: 0px 4px;" data-width="670" data-height="410" data-title="售后退款" data-params="oid/<?=$val['order_id']?>"><i class="icon-hand-up"></i></a>&nbsp;&nbsp;
						  <?php }elseif(in_array($val['order_status'],array('1'))){?>
						  <?php if($express == true){?>
					      	<a class="ifrm btn btn-warning" href="javascript:void(0)" data-url="/order/send" style="padding: 0px 4px;" data-width="450" data-height="360" data-title="订单发货" data-params="oid/<?=$val['order_id']?>"><i class="icon-hand-up"></i></a>&nbsp;&nbsp;
                          <button class="btn btn-primary ifrm" data-url="/order/exportSend" style="padding: 0px 4px;" data-width="670" data-height="410" data-title="打印发货单" data-params="oid/<?=$val['order_id']?>" style="position:relative;float:right;padding:3px 6px;margin-right:10px" title="导出发货单">发货单</button>
					  	  <?php }else{?>
						  	-
					  <?php }}else{?>
				      	-
				      <?php }?>
					  <else/>
						  -
					  </if>
				 </td>
		        </tr>
		        <?php }}else{?>
		        <td style="text-align:center;" colspan=8>暂无订单</td></tbody>
		        <?php }?>
		      </tbody>
	   </table>
	   <span style="float:right;margin-top:-44px"><?=$page?></span>
	</div>
</div>
<script>
$(function(){
	$('.deletes').click(function(){
		if(!window.confirm('确认取消该订单吗 ?')){
			return false;
		}
		window.location = $(this).attr('href');
	});

})
</script>